feat(pit): bring the Moshpit namespace into app.moshcode.sh - #113
Merged
Conversation
The TLD registry lived in the moshcoding app, which meant claiming
.eggs used a moshcoding account while the CLI authenticated against a
moshcode one. Two identities for one network, and no way to reach the
registry from the dashboard you actually sign into.
Ported here so a TLD is owned by a `users` row -- the same account
`moshcode login` establishes.
src/lib/moshpit-name.mjs validation + policy, no db import
src/moshpit.mjs storage: claim, alias, exempt, resolve
src/routes/moshpit.mjs the API and /pit
src/migrations/006 moshpit_tlds, the append-only log, exemptions
scripts/seed-moshpit-tld assigns .moshpit to the operator, idempotent
Also adds the resolution-precedence option tronbrowser.dev needs:
GET /api/moshpit/resolve?name=&mode= returns `prefer`, one of clearnet /
fallback / moshpit. Default mode is clearnet, where a registered name
only fills a gap DNS leaves ("fallback"); mode=moshpit is the opt-in
that lets a name in the pit outrank a squatted clearnet domain.
Whether clearnet actually answers is deliberately not decided here. The
extension is the thing holding the DNS result, and an ICANN TLD list
baked into the server would be stale within the week -- so the server
states the rule and the client applies it. Overriding DNS is never the
default: a resolver that silently outranked real DNS the first time it
was switched on would hijack names its operator never meant to touch.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
ralyodio
added a commit
that referenced
this pull request
Jul 31, 2026
Resolved against the work that landed since this branch was cut: - sessions.mjs: keep main's buffered watcher (subscribe before replaying the scrollback), its credit balance in the app bar, and its command-ack validation. The size frame goes out before the replay — the emulator has to be the right width before the first replayed line reaches it — and a resize arriving mid-replay is held and flushed behind it like any other event. - mirror.mjs: keep main's engineDirty flush condition; geometry rides along with the same post. - Dropped the /pit route this branch added: main now serves /pit as the Moshpit namespace page (#113), and sessionsRouter is mounted first, so keeping it would have shadowed that page. - Renumbered the migration to 007, behind main's 006_moshpit.sql. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the Moshpit TLD registry out of the
moshcodingapp and into this PWA, so a TLD is owned by the same accountmoshcode loginestablishes instead of a second, unrelated one.Previously: claiming
.eggsused a moshcoding account, the CLI authenticated against a moshcode account, and there was no way to reach the registry from the dashboard you actually sign into.What's here
src/lib/moshpit-name.mjssrc/moshpit.mjssrc/routes/moshpit.mjs/pitsrc/migrations/006_moshpit.sqlmoshpit_tlds, the append-only log, exemptionsscripts/seed-moshpit-tld.mjs.moshpitto the operator; idempotentOwnership hangs off
users(id). Claims are decided by the PRIMARY KEY, not a read-then-write — the insert is the check, so two simultaneous claims can't both pass.moshpit_tld_logis append-only and is the record of who claimed first; themoshpit_tldsrow is a cache of it.Resolution precedence (tronbrowser.dev)
GET /api/moshpit/resolve?name=<name>&mode=<clearnet|moshpit>now returnsprefer:preferclearnetfallbackmoshpitmode=clearnetis the default and yieldsfallbackfor a registered name — DNS stays authoritative, the pit fills gaps.mode=moshpitis the opt-in that letsprofullstack.aiin the pit outrank a squattedprofullstack.aiin clearnet.Two deliberate calls:
moshpit.Verification
npm test→ 146 pass, 0 fail (26 new)/pit200,/api/moshpit/tlds200,/api/moshpit/resolve200, malformed name 400Follow-ups (not in this PR)
pit.moshcode.shfrom the moshcoding service to this one.moshpitheremoshcodingonce this is live🤖 Generated with Claude Code